package com.youlv.yl.controller;


import com.youlv.yl.dto.CommentDto;
import com.youlv.yl.dto.CommentReplyDto;
import com.youlv.yl.service.intf.MoodCommentService;
import com.youlv.yl.vo.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fenghe
 * @since 2022-01-17
 */
@RestController
@RequestMapping("/yl/comment")
@Api(value = "实现动态评论的相关操作", tags = "实现动态评论的相关操作")
@CrossOrigin
public class MoodCommentController {
    @Autowired
    private MoodCommentService service;

    /** 发布评论*/
    @PostMapping("sendc.do")
    public R sendc(@RequestBody CommentDto dto) {
        return service.save(dto);
    }

    /** 发布回复*/
    @PostMapping("sendcr.do")
    public R sendCR(@RequestBody CommentReplyDto dto) {
        return service.saveRep(dto);
    }

    /** 查询动态的评论列表*/
    @GetMapping("commentlist.do")
    public R query(Long mid) {
        return service.queryByMid(mid);
    }
}
